﻿@model S4Store.Models.TelSellerKpi.SellerListModel
@{
    Layout = null;
    ViewBag.Title = "SellerList";
}
@{int i=0;}
@foreach (var seller in Model.Sellers)
{
    for (int j = 0; j < Model.CarBrands.Count(); j++)
    {
        var brand = Model.CarBrands[j];
        var config = Model.GetSellerMonthConfig(seller.Id,brand.Id);
        <tr>
             @if(j==0)
            {
                <th rowspan="@Model.CarBrands.Count()"><div class="wd50 pd510">@seller.Name</div></th>
            }
            <td><div class="wd50 pd510">@brand.Name
                <input type="hidden" name="seller[@i].SellerId" value="@seller.Id" />
                <input type="hidden" name="seller[@i].CarBrandId" value="@brand.Id" />
		</div>
            </td>
            @if (config == null)
            {
                <td><div class="wd50 pd510"><input type="text" class="textInput numberinput" size="5" name="seller[@i].LastMonthPotentialClient" value="0" /></div></td>
                <td><div class="wd50 pd510"><input type="text" class="textInput numberinput" size="5" name="seller[@i].SaleTarget" value="0" /></div></td>
            }
            else
            {
                <td><div class="wd100 pd510"><input type="text" class="textInput numberinput" size="5" name="seller[@i].LastMonthPotentialClient" value="@config.LastMonthPotentialClient" /></div></td>
                <td><div class="wd60 pd510"><input type="text" class="textInput numberinput" size="5" name="seller[@i].SaleTarget" value="@config.SaleTarget" /></div></td>
            }
        </tr>
        i++;
    }
  <tr><td colspan="23" style="background:#757576; height:2px; padding:0"></td></tr>
}

